<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>演示：FullCalendar应用——增删改数据操作</title>
<meta name="keywords" content="日程安排,FullCalendar,日历,JSON,jquery实例">
<meta name="description" content="在线演示FullCalendar新建、修改和删除日程事件的示例。">

<link rel="stylesheet" type="text/css" href="css/fullcalendar.css">

<style type="text/css">
#calendar{width:960px; margin:20px auto 10px auto}

</style>
<script type="text/javascript"
    src="js/jquery-ui-1.11.4.custom/external/jquery/jquery.js"></script>
<script type="text/javascript"
	src="js/jquery-ui-1.11.4.custom/jquery-ui.js"></script>
<link rel="stylesheet" href="js/jquery-ui-1.11.4.custom/jquery-ui.css">
<script src='js/fullcalendar.min.js'></script>
<script src='js/jquery.fancybox-1.3.1.pack.js'></script>
<script type="text/javascript">
$(function() {
    var events;
    $
            .ajax({
                type : "POST",
                url : "getTaskJson.action",
                traditional : true,
                dataType : "json",
                async : false,
                error : function(
                        request) {
                    alert("发送请求失败！");
                },
                success : function(data) {
                    events = eval("("
                            + data
                            + ")");
                          
                }
               
            });

 
	$('#calendar').fullCalendar({
		header: {
			left: 'prev,next today',
			center: 'title',
			right: 'month,agendaWeek,agendaDay'
		},
		events: events,
		dayClick: function(date, allDay, jsEvent, view) {
			var selDate =$.fullCalendar.formatDate(date,'yyyy-MM-dd');
            window
													.open(
															"newschedule.jsp",
															"",
															"menubar=no,states=no,scrollbars=yes,directories=no,location=no,toolbar=no,height=300,width=500");
          
//            $('#calendar').fullCalendar( 'addEventSource', source );
			
    	},
    	
    	eventClick: function(event, jsEvent, view) {
           
           var id=event.id;
           var content=event.title;
           var isWholeDay=event.isWholeDay;
           var startTime=$.fullCalendar.formatDate(event.start,'yyyy-MM-dd HH:mm:ss');
           
           var endTime=event.endTime;
           var address=event.address;
           var status=event.status;
           var important=event.important;
           var action="showTaskJson.action?id="+id+"&content="+content+"&isWholeDay="+isWholeDay+
           "&startTime="+startTime+"&endTime="+endTime+"&address="+address+"&status="+status+"&important="+important;
         
            window
													.open(
															action,
															"",
															"menubar=no,states=no,scrollbars=yes,directories=no,location=no,toolbar=no,height=300,width=500");

}
	});
});
</script>
</head>

<body>


<div id="main" style="width:1060px">
   
   <div id='calendar'></div>
</div>

</body>
</html>
